<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Factories\HasFactory;

class Role extends Base
{
    use HasFactory;
    protected $table='roles';

    public function setMenusAttribute($value)
    {
        $this->attributes['menus']= json_encode($value);
    }
    public function getMenusAttribute()
    {
//        dd(json_decode($this->attributes['menus'],true));
        return json_decode($this->attributes['menus'],true);
    }
    public function admin()
    {
        return $this->hasMany(Admin::class, 'id');
    }

//    public function menu()
//    {
//        return $this->hasOne(Menu::class);
//    }
}
